 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

{strip}
{assign var="pageTitle" value="Chung tu"}
{if ($loaitien) != 'VND' }
	{assign var="socot" value="6"}
{else}
	{assign var="socot" value="5"}
{/if}


{assign var="ngct" value=$smarty.now|date_format:"%d/%m/%Y"}
{include file="common/header.tpl"}

{/strip}

</br>

<form method="post" action="{url Nam= $xNam ChiTiet = $ChiTiet mant = $loaitien} ">

<table width = "60%" align = "center" >
<tr rowspan = "2">
<td width = "70%" align = "center" >
	<hr size="2" noshade style="color:#000000"  />

	T&#7915; ngày: 
	{html_select_date prefix="dateExpire1" all_extra="class=\"selectMenu\""  day_extra= 1 start_year="-5" end_year="+5" time="$Date1"}
	<br>

	&#272;&#7871;n ngày: 
	{html_select_date prefix="dateExpire2" all_extra="class=\"selectMenu\""  day_extra= 1 start_year="-5" end_year="+5" time="$Date2"}
	<hr style="height:5px; visibility:hidden;" />
	<select name="searchField" size="1" class="selectMenu">
		{html_options options=$fieldOptions selected=$searchField}
	</select>

	<select name="searchMatch" size="1" class="selectMenu">
		<option value="contains"{if $searchMatch == 'contains'} selected="selected"{/if}>C&#243; ch&#7913;a</option>
		<option value="is"{if $searchMatch == 'is'} selected="selected"{/if}>L&#224;</option>
		<option value="startsWith"{if $searchMatch == 'startsWith'} selected="selected"{/if}>B&#7855;t &#273;&#7847;u l&#224; </option>
	</select>


	<input type="text" size="10" name="search" class="textField" value="{$search|escape}" />&nbsp;
	<hr size="2" noshade style="color:#000000"  />
		
</td>

<td width = "30%" align = "left">
	<input type="submit" value="Xem các phiếu" class="button defaultButton" />
</td>
</tr>

<tr>

</tr>
</table>

<br>

{assign var="socot" value="9"}
{assign var="socot1" value="8"}

<br>
<table width = "80%" align = "left">
 {if $ctkts->wasEmpty()}
<tr>
	<td colspan="{$socot1}" class="nodata">Không có dữ liệu</td>
	<td> Thêm chứng từ mới</td>
</tr>
<tr>
	<td colspan="{$socot}" class="endseparator">&nbsp;</td>
</tr>

{else}
<tr>
	<td colspan="{$socot1}" align="left">{page_info iterator=$ctkts}
	&nbsp  &nbsp &nbsp &nbsp
	{page_links anchor="ctkts" name="ctkts" iterator=$ctkts searchField=$searchField searchMatch=$searchMatch search=$search ngay1 = $Date1 ngay2 = $Date2 ChiTiet=$mact}</td>
	<td>
	<input type="button" value="Thêm chứng từ mới" class="button" onclick="document.location.href='{url page= "acctCN" op='CTBANHANG' ChiTiet=$mact Mode = 'add' Nam=$xNam escape=false}'" /> 
	</td>

</tr>

{/if}
</table>


</form>
<div id="sections">

<table id="customers"  width="90%" align = "center" cellspacing="0" >
        {if ($loaitien eq "VND")}
		<tr>
		    <th>Ngày</th>
		    <th>Số CT</th>
		    <th>Diễn giải</th>
		    <th class="soquy">TK</th>
		    <th>TK ĐU</th>
		    <th>Chi tiết</th>
		    <th id="sotien">Phát sinh</th>

		    <th>Tac vu</th>
		</tr>
		{foreach from=$ctkts item=ctkt}
		<tr>
		    <td>
			{$ctkt.ngct|date_format:"%d/%m/%Y"}
		    </td>
		    <td>
			{$ctkt.soct}
		    </td>
		    <td style="text-align:left" id="noidung">
			{$ctkt.diengiai}
		    </td>
		    <td style="text-align:left">
		    {$ctkt.tk}
		    </td>
		    <td style="text-align:left">
			{$ctkt.tkdu}
		    </td>
		    <td style="text-align:left">
			{$ctkt.macttkdu}
		    </td>

		    <td style="text-align:right" id="sotien">
			 {$ctkt.sotienvn|number_format:0:".":"."}
		    </td>
		    <td >
			<a  id = '{$ctkt.idphieu}' class="actiondelrow" href="javascript:void(0);" onclick="PrintCT('{$ctkt.idphieu}', '{$xNam}', '{$noco}','{$urlIn}');">In </a>  &nbsp &nbsp
			<a  id = '{$ctkt.idphieu}' class="actiondelrow" href="javascript:void(0);" onclick="editCT('{$ctkt.idphieu}', '{$url}');">S&#7917;a </a>  &nbsp &nbsp
			<a  id = '{$ctkt.idphieu}' class="actiondelrow" href="javascript:void(0);" onclick="deleCT('{$host}', '{$username}', '{$password}', '{$databaseName}', '{$journalid}','{$xNam}', '{$ctkt.idphieu}', '{$ctkt.soct}', '{$urlDel}', '{$urlRFR}');">X&#243;a </a>  
		    </td>
		</tr>
		{/foreach}
	{else}
		<tr>
		    <th>Ngày</th>
		    <th>Số CT</th>
		    <th>Diễn giải</th>
		    <th class="soquy">TK</th>
		    <th>TK ĐU</th>
		    <th>Chi tiết</th>
		    <th id="sotien">{$loaitien}</th>
		    <th id="sotien">VNĐ</th>

		    <th>Tac vu</th>
		</tr>

		{foreach from=$ctkts item=ctkt}

		<tr>
		    <td>
			{$ctkt.ngct|date_format:"%d/%m/%Y"}
		    </td>
		    <td>
			{$ctkt.soct}
		    </td>
		    <td style="text-align:left" id="noidung">
			{$ctkt.diengiai}
		    </td>
		    <td style="text-align:left">
		    {$ctkt.tk}
		    </td>
		    <td style="text-align:left">
			{$ctkt.tkdu}
		    </td>
		    <td style="text-align:left">
			{$ctkt.macttkdu}
		    </td>

		    <td style="text-align:right" id="sotien">
			 {$ctkt.sotiennt|number_format:2:",":"."}
		    </td>
		    <td style="text-align:right" id="sotien">
			 {$ctkt.sotienvn|number_format:0:".":"."}
		    </td>

		    <td >
			<a  id = '{$ctkt.idphieu}' class="actiondelrow" href="javascript:void(0);" onclick="PrintCT('{$ctkt.idphieu}', '{$xNam}', '{$noco}','{$urlIn}');">In </a>  &nbsp &nbsp
			<a  id = '{$ctkt.idphieu}' class="actiondelrow" href="javascript:void(0);" onclick="editCT('{$ctkt.idphieu}', '{$url}');">S&#7917;a </a>  &nbsp &nbsp
			<a  id = '{$ctkt.idphieu}' class="actiondelrow" href="javascript:void(0);" onclick="deleCT('{$host}', '{$username}', '{$password}', '{$databaseName}', '{$journalid}','{$xNam}', '{$ctkt.idphieu}', '{$ctkt.soct}', '{$urlDel}', '{$urlRFR}');">X&#243;a </a>  
		    </td>
		</tr>
		{/foreach}

	{/if}

</table>

</div>
{include file="common/footer.tpl"}

</body>
</html>

	
